package com.street.controller.user;

import com.street.entity.Shop;
import com.street.result.Result;
import com.street.service.ShopService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/user/shop")
@Slf4j
@Api(tags = "用户端商户相关接口")
public class ShopController {
    @Autowired
    private ShopService shopService;

    @GetMapping("/list")
    @ApiOperation("展示所有商户")
    public Result<List<Shop>> shopList(){
        List<Shop> list = shopService.list();
        return Result.success(list);
    }

    @GetMapping("/detail")
    @ApiOperation("获得单个商户信息")
    public Result<Shop> getShopDetail(Long shopId){
        Shop shop=shopService.getShopDetail(shopId);
        return Result.success(shop);
    }
}
